﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.Web.UI.Controls;
using ZX.CRM.Library;
using ZX.CRM.Bussiness;
using ZX.DBModule;
using ZX.Common;
using ZX.SYS.Library;
using ZX.BLL;
using ZX.Web.UI.Controls.ControlBind;

namespace ZX.WebApp.Crm.Customer
{
    public partial class AddLayoutRecord : BasePage
    {
        string strProductPack = "", strUnitId = "", strState = "";
        BCrmProductPack bllProdcutPack = new BCrmProductPack();
        BDatPhraseDetail bllDetail = new BDatPhraseDetail();
        BCrmProductLayout bllProductLayout = new BCrmProductLayout();

        protected void Page_Load(object sender, EventArgs e)
        {
            string strAction=this.GetStringFromQueryString("flag","");
            if (strAction == "0")
            {
                this.ID.Value = "";
            }
            else
            {
                string strRecordId = this.GetStringFromQueryString("id", "");
                this.ID.Value = strRecordId;
            }

            //状态
            IList<DatPhraseDetail> ListStateId = bllDetail.GetDatPhraseDetailByClassValue("OrderStateID");
            DropDownListControl.DropDataSourceBind(this.State, ListStateId, "PhraseText", "PhraseID");

            IList<CrmProductPack> ListProductPack = bllProdcutPack.GetAllProductPack();
            if (ListProductPack != null && ListProductPack.Count > 0)
            {
                IList<BaseEntity> _ListProductPack = new List<BaseEntity>();
                foreach (var _e in ListProductPack)
                {
                    _ListProductPack.Add(_e);
                }
                strProductPack = _ListProductPack.ToJSON().Replace("\n", "").Replace("\r", "").Replace("@@", "");
            }
            //单位
            IList<DatPhraseDetail> ListUnitId = bllDetail.GetDatPhraseDetailByClassValue("UnitId");
            if (ListUnitId != null && ListUnitId.Count > 0)
            {
                IList<BaseEntity> _ListUnitId = new List<BaseEntity>();
                foreach (var _e in ListUnitId)
                {
                    _ListUnitId.Add(_e);
                }
                strUnitId = _ListUnitId.ToJSON().Replace("\n", "").Replace("\r", "").Replace("@@", "");
            }
            //状态
            IList<DatPhraseDetail> ListState = bllDetail.GetDatPhraseDetailByClassValue("OrderStateID");
            if (ListState != null && ListState.Count > 0)
            {
                IList<BaseEntity> _ListState = new List<BaseEntity>();
                foreach (var _e in ListState)
                {
                    _ListState.Add(_e);
                }
                strState = _ListState.ToJSON().Replace("\n", "").Replace("\r", "").Replace("@@", "");
            }
        }

        /// <summary>
        /// 标题
        /// </summary>
        public string PageTitle
        { get { return this.GetStringFromQueryString("title", ""); } }
        /// <summary>
        /// 产品包信息
        /// </summary>
        public string ProductPack
        { get { return strProductPack; } }
        /// <summary>
        /// 计量单位
        /// </summary>
        public string ListUnitId
        { get { return strUnitId; } }
        /// <summary>
        /// 状态
        /// </summary>
        public string ListState
        { get { return strState; } }
    }
}